import {createRouter, createWebHistory} from 'vue-router'
// 组件导入
import Layout from '@/views/layout/index.vue'
import UserView from '@/views/user/index.vue'
import UserLoginView from '@/views/login/login.vue'
import IndexView from '@/views/index/index.vue';
import CategoryView from '@/views/category/index.vue';
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      children: [
        {path: '/', redirect: '/index'},
        {path: '/index', name: 'index', component: IndexView},
        {path: '/user', name: 'user', component: UserView},
        {path: '/category', name: 'category', component: CategoryView},

      ]
    }, {path: '/user/login', name: 'userLogin', component: UserLoginView}
  ],
})

export default router
